Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Query): Fix incorrect RDF response. #7017

Merged
merged 7 commits into from
Dec 7, 2020
Merged

Conversation

minhaj-shakeel
Copy link
Contributor

@minhaj-shakeel minhaj-shakeel commented Nov 30, 2020

Fixes DGRAPH-2781.
Fixes DGRAPH-2552.

This PR fixes Some of the bugs in the RDF response.
For the given schema:

name: string @index(exact) .
friend: [uid] .
type Person {
	name
	friend
}
  1. For a query:
query(func: type(Person)){
	uid
	name
}

The output was:

<0x5573a> <uid> <0x5573a> .
<0x5573c> <uid> <0x5573c> .
<0x5573d> <uid> <0x5573d> .
<0x5573a> <name> "Charlie" .
<0x5573c> <name> "Alice" .
<0x5573d> <name> "Bob" .

The redundant <X> <uid> <X> triplets should be removed from the RDF output. This PR fixes that.

  1. For the given query:
query(func: type(Person)){
	name
	friend
}

The RDF response is:

<0x5573a> <name> "Charlie" .
<0x5573c> <name> "Alice" .
<0x5573d> <name> "Bob" .
<0x5573c> <friend> <0x5573a> .
<0x5573c> <friend> <0x5573d> .

The <X> <friend> <X> edge should not be there as it is inconsistent with the JSON response.
This issue also lies in the recurse queries. For eg for this query:

query(func: type(Person)) @recurse(depth: 1, loop: false){
	name
	friend
}

This PR fixes these issues.


This change is Reviewable

@netlify
Copy link

netlify bot commented Nov 30, 2020

Deploy preview for dgraph-docs ready!

Built with commit 469866f

https://deploy-preview-7017--dgraph-docs.netlify.app

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @minhaj-shakeel)

@pawanrawal pawanrawal merged commit 17df3f5 into master Dec 7, 2020
@pawanrawal pawanrawal deleted the minhaj/fix-rdf-stream branch December 7, 2020 11:42
NamanJain8 pushed a commit that referenced this pull request Dec 7, 2020
* remove <X> <uid> <X> type of triplets from the output

* fix output for recurse queries

* fix for recurse queries

* fix test

* add Test for ignoring uid

* minor modification

* fix solution for recurse

(cherry picked from commit 17df3f5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants